@echo off

set REMOTE_REPO_BASE=https://gitcafe.com/digimobistudio
set REPOS=data-migrate,data-migrate-olap,dms,weos,elanding

set REPO_BASE=%CD%

for %%i in (%REPOS%) do (
	call :sync_repo %%i
)

goto :EOF


:sync_repo

set REPO=%REPO_BASE%\%1
set REMOTE_REPO=%REMOTE_REPO_BASE%/%1.git

if exist "%REPO%\.git" ( 
	call :update_repo %REMOTE_REPO% %REPO%
) else ( 
	call :clone_repo %REMOTE_REPO% %REPO%
) 

goto :EOF

:clone_repo

set current.repo=%2
set current.remote.repo=%1

if not exist "%current.repo%" ( 
	mkdir "%current.repo%"
) 

cd %REPO_BASE%
git clone %current.remote.repo%

goto :EOF


:update_repo
set current.repo=%2
set current.remote.repo=%1

cd %current.repo%
git pull origin develop develop

goto :EOF

